//package com.appjishu.web.config;
//
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import io.swagger.annotations.Api;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.service.ApiKey;
//import springfox.documentation.service.AuthorizationScope;
//import springfox.documentation.service.SecurityReference;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spi.service.contexts.SecurityContext;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//@Api(hidden = true)
//@Controller
//@Configuration
//@EnableSwagger2
//public class SwaggerConfiguration {
//
//    @RequestMapping("/")
//    public String home() {
//        return "redirect:swagger-ui.html";
//    }
//
//	@Bean
//	public Docket startApiDocket() {
//		return new Docket(DocumentationType.SWAGGER_2)
//				.enable(true) // 生产环境可以配置关闭
//				.groupName("pote")
//				.apiInfo(apiInfo())
//				.select()
////				.apis(RequestHandlerSelectors.basePackage("com.sany"))
////				.apis(RequestHandlerSelectors.basePackage("io.github.alphajiang.hyena.rest"))
////				.paths(PathSelectors.regex("/font(/[\\w-]*)*"))
//				.build()
//				.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header"),new ApiKey("userId", "userId", "header")))
//				.securityContexts(Arrays.asList(SecurityContext.builder()
//                        .securityReferences(defaultAuth())
//                        .forPaths(PathSelectors.regex("^(?!auth).*$"))
//                        .build()));
//	}
//
//	private List<SecurityReference> defaultAuth() {
//        AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
//        AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
//        authorizationScopes[0] = authorizationScope;
//        List<SecurityReference> securityReferences=new ArrayList<>();
//        securityReferences.add(new SecurityReference("token", authorizationScopes));
//        return securityReferences;
//    }
//
//	private ApiInfo apiInfo() {
//		return new ApiInfoBuilder()
//				.title("诊改资料系统 API")
//				.description("请求接口需要对参数进行签名以确定安全，具体签名算法见外部文档")
//				.termsOfServiceUrl("http://api-test.sany.com/")
//				.version("1.0").build();
//	}
//}
